package com_djm_2025_06_10.demo2;

public class Test {
    //浅克隆
    public static void main1(String[] args) throws CloneNotSupportedException{
        Person person = new Person("djm",22);

        System.out.println(person);

        Person person1 = (Person) person.clone();

        System.out.println(person1);
    }

    //深克隆
    public static void main(String[] args) throws CloneNotSupportedException{
        Teacher teacher1 = new Teacher("djm",22,"001",new Salary(10000));

        System.out.println(teacher1);

        Teacher teacher2 = (Teacher) teacher1.clone();

        System.out.println(teacher2);
    }
}
